<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
   
</head>
<body>
   

    <script>

        let number = 10;
        let person = {
            name:'jack',
            sex:'男',
            // age:'14'
        }

        Object.defineProperty(person,'age',{
            // value:'19',
            // enumerable: true,       //可枚举
            // writable:true,          //可修改
            // configurable:true,       //可删除


            set(val){
                number = val
            },
            get(){
                return number
            }
        })

        console.log(person)
    </script>
    
</body>
</html>